package com.sdy.healthcode.biz.constants;

import lombok.Getter;
import lombok.Setter;

import java.util.stream.Stream;

public enum HealthAbnormalType {
    NORMAL("无异常", 0),
    FEVER("发热（体温≥37.3℃）", 10),
    FATIGUE("乏力", 3),
    DRY_COUGH("干咳", 3),
    NASAL_CONGESTION("鼻塞", 2),
    RUNNY_NOSE("流涕", 2),
    SORE_THROAT("咽痛", 3),
    DIARRHEA("腹泻", 3);

    @Getter
    @Setter
    private String type;
    @Getter
    @Setter
    private Integer score;

    HealthAbnormalType(String type, Integer score) {
        this.type = type;
        this.score = score;
    }

    public static HealthAbnormalType from(String type) {
        return Stream.of(HealthAbnormalType.values()).filter(v -> v.type.equals(type)).findAny().orElse(null);
    }
}
